<template>
  <div class="book">
    <van-sticky>
      <div class="nav-top">
        <div class="nav-top-left">
          <button class="btn" @click="showTime">
            <div class="nav-left-title">书架</div>
            <img src="../assets/bottom.png" alt="" />
          </button>
        </div>
        <div class="nav-top-right">
          <div class="nav-top-right-img">
            <img @click="goToSearch" src="../assets/search.png" alt="" />
            <img @click="goToHistory" src="../assets/history.png" alt="" />
            <img @click="noOrYes" src="../assets/more.png" alt="" />
          </div>
        </div>
      </div>
    </van-sticky>

    <div class="mask" v-if="isYes" @click="showTime"></div>
    <div class="wrap" v-if="isYes">
      <div class="wrap-box" @click="showTime">
        <div class="content">
          <div class="content-box"></div>
          <div class="book">
            <img src="../assets/book.png" alt="" />
            <span @click="toTrue">书架</span>
          </div>
          <div class="localbook">
            <img src="../assets/localbooks.png" alt="" />
            <span @click="toFlag">本地书</span>
          </div>
        </div>
      </div>
    </div>

    <div class="mask2" v-if="nooryes" @click="noOrYes"></div>
    <div class="wrap2" v-if="nooryes">
      <div class="wrap-box2" @click="noOrYes">
        <div class="content2">
          <div class="way-item">
            <img src="../assets/getin.png" alt="" />
            <span>导入本机书籍</span>
          </div>
          <div class="way-item">
            <img src="../assets/allone.png" alt="" />
            <span>批量管理</span>
          </div>
          <div class="way-item">
            <img src="../assets/list.png" alt="" />
            <span>列表模式</span>
          </div>
          <div class="way-item">
            <img src="../assets/wifi.png" alt="" />
            <span>WiFi传书</span>
          </div>
          
        </div>
      </div>
    </div>
    <!-- <keep-alive> -->
    <router-view></router-view>
    <!-- </keep-alive> -->
  </div>
</template>

<script>
export default {
  name: "bookshelf",
  data() {
    return {
      isYes: false,
      banner: {},
      book: [],
      flag: true,
      nooryes: false,
    };
  },
  created() {
  },
  methods: {
    toFlag() {
      this.$router.push({ name: "LocalBookShelf" });
    },
    toTrue() {
      this.$router.push({ name: "BookView" });
    },
    showTime() {
      this.isYes = !this.isYes;
    },
    goToSearch() {
      this.$router.push({ name: "Search" });
    },
    goToHistory() {
      this.$router.push({ name: "History" });
    },
    noOrYes() {
      this.nooryes = !this.nooryes;
    },
  },
};
</script>

<style lang="less" scoped>
.nav-top {
  display: flex;
  padding-top: 5px;
  justify-content: space-between;
  background-color: white;
  //   height: 30px;
}
.nav-left-title {
  display: inline-block;
  font-size: 16px;
}
body,
html {
  margin: 0;
  padding: 0;
}
.mask {
  width: 100vw;
  height: 100vh;
  background-color: #ccc;
  opacity: 0.5;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
}
.wrap {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  //   z-index: 999;
}
.wrap-box {
  width: 100vw;
  height: 100vh;
  display: flex;
  //   justify-content: center;
  //   align-items: center;
}
.content::before {
  content: "";
  // background-color: red;
  position: relative;
  // display: block;
  top: -20px;
  left: 20px;
  border-bottom: 10px solid white;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}
.content {
  width: 180px;
  height: 70px;
  background-color: white;
  opacity: 1000;
  z-index: 2000;
  position: relative;
  top: 40px;
  border-radius: 10px;
  padding: 0 10px;
  span {
    display: inline-block;
    margin-left: 5px;
    font-size: 13px;
  }
  .book {
    margin-bottom: 5px;
    span {
      //   margin-top: -5px;
      position: relative;
      top: -5px;
    }
    img {
      width: 20px;
    }
    p {
      display: inline-block;
    }
  }
  .localbook {
    span {
      //   margin-top: -5px;
      position: relative;
      top: -5px;
    }
    img {
      width: 20px;
    }
    p {
      display: inline-block;
    }
  }
}

.mask2 {
  width: 100vw;
  height: 100vh;
  background-color: #ccc;
  opacity: 0.5;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
}
.wrap2 {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  //   z-index: 999;
}
.wrap-box2 {
  width: 100vw;
  height: 100vh;
  display: flex;
  //   justify-content: center;
  //   align-items: center;
}
.content2::before {
  content: "";
  // background-color: red;
  position: absolute;
  // display: block;
  top: -10px;
  left: 135px;
  border-bottom: 10px solid white;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}
.content2 {
  width: 155px;
  height: 155px;
  background-color: white;
  opacity: 1000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  position: relative;
  top: 40px;
  left: 200px;
  border-radius: 10px;
  margin-left: 15px;
  //   padding: 0 10px;
  .way-item {
      margin-top: 11px;
      padding-left: 15px;
    img {
      width: 20px;
      height: 20px;
    }
    span {
      display: inline-block;
      margin-left: 5px;
      font-size: 13px;
      position: relative;
      top: -5px;
    }
  }
}

.btn {
  border: transparent;
  background-color: transparent;
}
.nav-top-right-img {
  margin-top: 3px;

  img {
    width: 18px;
    margin-right: 10px;
  }
}
</style>